package com.zqy.common;

import java.io.Serializable;

public class PmpResult implements Serializable {

    private static final long serialVersionUID = 1L;

    public static final String STATUS_100 = "pmp-100";
    public static final String STATUS_200 = "pmp-200";
    public static final String STATUS_300 = "pmp-300";
    public static final String STATUS_400 = "pmp-400";
    public static final String STATUS_401 = "pmp-401";
    private String status;
    private String message;
    private Object data;

    public PmpResult() {
        super();
    }

    public PmpResult(String status, String message, Object data) {
        super();
        this.status = status;
        this.message = message;
        this.data = data;
    }

    public static PmpResult success(Object data) {
        return success("success", data);
    }

    public static PmpResult success(String message, Object data) {
        return new PmpResult(STATUS_200, message, data);
    }

    public static PmpResult paramError(String message) {
        return paramError(message, null);
    }

    public static PmpResult paramError(String message, Object data) {
        return new PmpResult(STATUS_100, message, data);
    }

    public static PmpResult serviceError(String message) {
        return serviceError(message, null);
    }

    public static PmpResult serviceError(String message, Object data) {
        return new PmpResult(STATUS_400, message, data);
    }

    public static PmpResult unauthorizedError(String message) {
        return unauthorizedError(message, null);
    }

    public static PmpResult unauthorizedError(String message, Object data) {
        return new PmpResult(STATUS_401, message, data);
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    @Override
    public String toString() {
        return "PmpResult [status=" + status + ", message=" + message + ", data=" + data + "]";
    }

}
